<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1" import="org.apak.model.*"
	import="java.util.*"%>
<%
	JspWriter outPrint = pageContext.getOut();
	HttpSession sessions = request.getSession(true);
	LoggedSubject loggedSubject = (LoggedSubject) sessions.getAttribute("loggedSubject");
	if(!loggedSubject.isCustomer()) {
		outPrint.print("<input type=\"hidden\" id=\"firstName\" value=\"" + loggedSubject.getName() +"\"/>");
		outPrint.print("<input type=\"hidden\" id=\"lastName\" value=\"" + loggedSubject.getSurname() +"\"/>");
	}
	ArrayList<ServiceNote> listOfEmployeeServiceNotes = (ArrayList<ServiceNote>) request
			.getAttribute("employeeServiceNoteList");
	ServiceNote employeeServiceNote = (ServiceNote) request
			.getAttribute("employeeServiceNote");
	if (employeeServiceNote == null && !loggedSubject.isCustomer()) {
		outPrint.print("<input type=\"button\" name=\"actionButton\" id=\"addNote\" value=\"Add note\"/>");
	}
	outPrint.println("<div id=\"listOfEmployeeNotes\">");
	outPrint.println("<table id=\"tableOfEmployeeNotes\">");
	outPrint.println("<tr><th>#</th><th>First name</th><th>Last name</th><th>Note</th><th>.....</th></tr>");
	int counter = 1;
	for (ServiceNote note : listOfEmployeeServiceNotes) {
		outPrint.println("<tr>");
		outPrint.println("<td>" + counter + "</td>");
		outPrint.println("<td>" + note.getEmployee_firstname()
				+ "</td>");
		outPrint.println("<td>" + note.getEmployee_lastname() + "</td>");
		outPrint.println("<td>" + note.getNote() + "</td>");
		if (employeeServiceNote != null) {
			if (note.getEmployee_fk() == employeeServiceNote
					.getEmployee_fk()) {
				outPrint.print("<td><input type=\"button\" name=\"actionButton\" id=\"editNote\" value=\"Edit note\"/><input type=\"button\" name=\"saveChangesNote\" id=\"saveChangesNote\" value=\"Save changes\"/></td>");
			}
		} else {
			outPrint.println("<td></td>");
		}
		outPrint.println("</tr>");
		counter++;
	}
	outPrint.println("</table>");
	outPrint.println("<div>");
%>
	<%
		if(!loggedSubject.isCustomer()) {
			outPrint.println("<div id=\"noteDiv\" style=\"display: none; margin-left: 300px;\">");
			outPrint.println("<textarea id=\"noteArea\"></textarea><br />");
			outPrint.println("<input type=\"button\" name=\"saveNote\" id=\"saveNote\" value=\"Save note\"/>");
			outPrint.println("</div><br />");
		}
		
	%>
